package adv1;

public class News {
	private String title;
	private String content;
	private String time;
	private String didian;

	public News() {
	}

	public News(String title, String content, String time, String didian) {
		super();
		this.title = title;
		this.content = content;
		this.time = time;
		this.didian = didian;
	}

//	@Override
//	public int hashCode() {
//		return title.hashCode();
//	}
//
//	// 相同的标准，就是title一致
//	@Override
//	public boolean equals(Object obj) {
//		if (obj instanceof News) {
//			News n = (News) obj;
//			return this.title.equals(n.title);
//		}
//		return false;
//	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		News other = (News) obj;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "News [title=" + title + ", content=" + content + ", time=" + time + ", didian=" + didian + "]";
	}

}
